<?php

namespace App\Exceptions;

use App\Common\Traits\ApiResponse;
use Exception;

class InternalException extends Exception
{
    use ApiResponse;
    protected $msgForUser;

    public function __construct(string $message, string $msgForUser = '系统内部错误', int $code = 500)
    {
        parent::__construct($message, $code);
        $this->msgForUser = $msgForUser;
    }

    public function render()
    {
        return $this->failed($this->msgForUser, $this->code);
    }
}
